package Servidor.Modelo.Games;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Angel Lopez
 */
public class GameList {

    private static GameList instancia = new GameList();

    private ArrayList<Game> lista_partidas = new ArrayList<Game>();
    
    private GameList(){

    }
    
    /**
     * @return instancia
     */
    public static GameList getInstance(){
        return instancia;
    }
    

    public void add_game(Game game){
        lista_partidas.add(game);
    }
    
    public Game getGame(int gameId){
        Iterator<Game> iter = lista_partidas.iterator();
        while(iter.hasNext()){
            Game game = iter.next();
            if (game.getId_game() == gameId)
                return game;
        }
        return null;
    }
    
    
    
    
}
